package com.qcq.wecheck.service;

import com.baomidou.mybatisplus.service.IService;
import com.qcq.wecheck.dto.AttendanceCountDto;
import com.qcq.wecheck.dto.ComboDto;
import com.qcq.wecheck.entity.Attendance;
import com.qcq.wecheck.entity.Schedule;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;

/**
 * <p>
 * 签到记录表 服务类
 * </p>
 *
 * @author O
 * @since 2018-09-19
 */
public interface AttendanceService extends IService<Attendance> {
	/**
	 * 根据openId和scheduleId获取特定考勤表
	 *
	 * @param openId     openId
	 * @param scheduleId 考勤表id
	 * @return list
	 */
	List<Attendance> getAttendances(String openId,
	                                Long scheduleId);

	/**
	 * 根据openId和scheduleId获取指定日期考勤次数
	 *
	 * @param openId     openId
	 * @param scheduleId 考勤表id
	 * @param date       date
	 * @return count
	 */
	Long getAttendanceCount(String openId,
	                        Long scheduleId,
	                        LocalDate date);

	/**
	 * 根据openId和scheduleId获取指定日期段考勤次数
	 *
	 * @param openId     openId
	 * @param scheduleId 考勤表id
	 * @param to         to
	 * @param from       from
	 * @return count
	 */
	List<AttendanceCountDto> getAttendanceCount(String openId,
	                                            Long scheduleId,
	                                            String from,
	                                            String to);

	/**
	 * 删除用户参与的签到活动(删除签到内容)
	 * 根据签到表的id和openId
	 *
	 * @param openId     id
	 * @param scheduleId id
	 * @return count deleted
	 */
	Integer deleteHistory(Long scheduleId, String openId);

	/**
	 * 签到统计
	 *
	 * @param openId   id
	 * @param schedule schedule
	 * @return comboDto
	 */
	ComboDto getCombo(Schedule schedule, String openId);

	/**
	 * 获取指定日期考勤情况列表
	 *
	 * @param date       date
	 * @param scheduleId id
	 * @param openId     id
	 * @return list
	 */
	List<Attendance> getByDate(String openId, Long scheduleId, String date);
}
